<?php
define('LEGAL_OPER', true);
require('../../includes/admin-init.php');
require(ROOT_PATH . '/class/utils/FileUtil.class.php');
require(ROOT_PATH . '/class/utils/ValidateUtil.class.php');

//上传产品图片
if($method == 'upimg'){
	$isImg = ValidateUtil::checkUploadImg("image", 1000000);
	if( $isImg != 1){
		echo ($isImg==3||$isImg==4?$isImg:0);
		exit;
	}
	$filename = $_FILES['image']['name'];
	$filename = substr($filename, strrpos($filename, ".")+1, strlen($filename)-strrpos($filename, "."));
	$path = '/temp/'.rand(0,99).'/'.rand(0,99);
	$filename = $path.'/'.time().rand(10,99).'.'.$filename;
	FileUtil::mkdirs(ROOT_PATH.$path);
	$b = move_uploaded_file($_FILES['image']['tmp_name'],ROOT_PATH.$filename);
	if($b){
		echo $filename;
	}else{
		echo "0";
	}
	exit;
}








